import { onMounted } from "vue";
import mitt from "mitt";
const emitter = mitt();
const customEmit = (eventName) => {
    emitter.emit(eventName)
}

const customOn = (eventName, callback = () => { }) => {
    emitter.on(eventName, callback)
}
export const useEventBus = () => {
    onMounted(() => {
        emitter.all.clear()
    })
    return {
        customEmit,
        customOn
    }
}

